<extend name='Public/_Main' />
<block name='title'>
    <title>字段管理</title>
</block>
<block name='right'>
    <form class="am-form">
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>排序</th>
                    <th>名称</th>
                    <th>字段</th>
                    <th>是否验证</th>
                    <th>配置值</th>
                    <th>表单类型</th>
                    <th>验证规则</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <foreach name='list' item='list'>
                    <tr>
                        <td class="id">{$list.id}</td>
                        <td>
                            <input type="text" class='node_sort form-control' value='{$list.sort}' name='sort' />
                        </td>
                        <td>
                            <a href="#">
                                <input type='text' value='{$list.name}' class='form-control' name='name'>
                            </a>
                        </td>
                        <td>
                            {$list.field}
                        </td>
                        <td>
                            <input type='text' value='{$list.control}' name='control' class='node_sort form-control'>
                        </td>
                        <td>
                            <input type='text' value='{$list.value}' name='value' class='form-control'>
                        </td>
                         <td>
                            <input type='text' value='{$list.type}' name='type' class='form-control' disabled>
                        </td>
                         <td>
                            <input type='text' value='{$list.require}' name='require' class='form-control'>
                        </td>
                        <td>
                            <div role="group" class="btn-group">
                                <a href="{:U('delfield',array('id'=>$list['id']))}" class="btn btn-danger getajax">删除</a></div>
                        </td>
                    </tr>
                </foreach>
            </tbody>
        </table>
        <div class="col-xs-6">
            <button type="button" class="btn btn-lg btn-danger btn-block disabled">保存提交</button>
        </div>
        <div class="col-xs-6">
            <a href="{:U('Model/index')}" class="btn btn-lg btn-default btn-block">返回</a>
        </div>
    </form>
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">新增字段</h4>
                </div>
                <div class="modal-body">
                    <form class="require" action="{:U('addfield')}" method="post">
                        <div class="form-group">
                            <label for="exampleInputEmail1">字段名<span class="Validform_checktip"></span></label>
                            <input type="text" class="form-control" placeholder="例：姓名" datatype='*' ajaxurl="{:U('addfield',array('id'=>$_GET['id']))}" name='name'>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">数据长度<span class="Validform_checktip"></span></label>
                            <input type="number" class="form-control" placeholder="例：100" datatype='n' name='length'>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">验证正则<span class="Validform_checktip"></span></label>
                            <input type="text" class="form-control" placeholder="例：支持正则表达式，或者validfrom验证规则" datatype='*' name='require'>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">是否必填<span class="Validform_checktip"></span></label>
                            <select name="control" class='form-control selectpicker' datatype='*'>
                                <option value="1">
                                  验证
                                </option>
                                <option value="0">
                                    不验证
                                </option>
                                
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">类型<span class="Validform_checktip"></span></label>
                            <select name="type" class='form-control selectpicker' datatype='*' data-live-search="true">
                                <option value="text|varchar">
                                    文本(text|varchar)
                                </option>
                                <option value="number|smallint">
                                    小类型数字(number|smallint)
                                </option>
                                <option value="number|float">
                                    浮点类型(number|float)
                                </option>
                                <option value="textarea|varchar">
                                    多行文本(textarea|varchar)
                                </option>
                                <option value="textarea|text">
                                    文本编缉器(textarea|text)
                                </option>
                                <option value="file|text">
                                    文件上传(file|text)
                                </option>
                                <option value="select|varchar">
                                    下拉菜单(select|varchar)
                                </option>
                                <option value="checkbox|varchar">
                                    多选(heckbox|varchar)
                                </option>
                                <option value="radio|varchar">
                                    单选(radio|varchar)
                                </option>
                                <option value="link|varchar">
                                    联动模型(link|varchar)
                                </option>
                                <option value="date|varchar">
                                    日期选择(date|varchar)
                                </option>
                                 <option value="city|varchar">
                                    地区选择
                                </option>
                                 <option value="select|char">
                                    关联表模型(select|char)
                                </option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">配置值<span class="Validform_checktip"></span></label>
                            <textarea class="form-control" rows="3" placeholder="例：请以逗号分格" datatype='*' name='value'></textarea>
                        </div>
                        <input type='hidden' name='modelid' value='{$Think.get.id}'/>
                        <div class="modal-footer">
                            <div class='col-xs-6'>
                                <button class="btn btn-lg btn-primary btn-block" type="submit">保存</button>
                            </div>
                            <div class='col-xs-6'>
                                <button class="btn btn-lg btn-default btn-block" type="button" data-dismiss="modal">关闭</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!--end Modal-->
</block>
<block name='javascript'>
    <script type="text/javascript">
    var romClassification = "{:U('field_rom')}";
    </script>
</block>
